﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Kokomo.Xml
{
	class RuntimeFieldSchema : PropertySchema
	{
		public RuntimeFieldSchema(FieldInfo field, PropertyNodeType nodeType, string nodeName, PropertySchemaFlags flags)
			: base(nodeName, field.FieldType, nodeType, flags)
		{
			ArgumentValidation.CheckNullArgument("field", field);

			this.Field = field;
		}

		public FieldInfo Field { get; private set; }

		public override object GetValue(object target)
		{
			return this.Field.GetValue(target);
		}

		public override void SetValue(object target, object value)
		{
			this.Field.SetValue(target, value);
		}
	}
}
